<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:52:"themes/admin_simpleboot3/admin/setting/password.html";i:1592967610;}*/ ?>
<link rel="stylesheet" href="__STATIC__/js/layui-v2.5.5/css/layui.css">

</head>
<body>
	<div class="wrap">
		<div class="layui-tab">
			<ul class="layui-tab-title">
				<li class="layui-this"><a href="<?php echo url('setting/password'); ?>"><i class="fa fa-lock"></i> 修改密码</a></li>
			</ul>
			<div style="height:400px; width:500px; margin:40px auto auto 40px ;">
				<form class="layui-form layui-form-pane input input-order" method="post" action="<?php echo url('setting/passwordPost'); ?>">
					<div class="layui-form-item ">
						<label class="layui-form-label" for="input-old_password">原始密码</label>
						<div class="layui-input-inline ">
							<input type="password" class="layui-input" lay-verify="old_password" lay-reqtext="原始密码" name="old_password">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label" for="input-password">新密码</label>
						<div class="layui-input-inline">
							<input type="password" class="layui-input" lay-verify="password" lay-reqtext="新密码" name="password">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label" for="input-repassword">重复密码</label>
						<div class="layui-input-inline">
							<input type="password" class="layui-input" lay-verify="repassword" lay-reqtext="重复密码" name="re_password">
						</div>
					</div>
					<div class="layui-form-item">
						<!-- <div class="col-sm-offset-2 col-sm-10"> -->
							<button type="submit" class="layui-btn" lay-submit="" lay-filter="demo" >保存</button>
						<!-- </div> -->
					</div>
				</form>
			</div>
		</div>
	</div>
	<!-- <script src="__STATIC__/js/admin.js"></script> -->
	<script src="__TMPL__/public/assets/js/jquery-1.10.2.min.js"></script>
<script src="__STATIC__/js/layui-v2.5.5/layui.all.js"></script>
	<script>
		;!function(){
			var form = layui.form
				,layer = layui.layer    //弹出层必需
				//自定义验证规则
				form.verify({
					old_password: [
						/^[\S]{6,16}$/
						,'原密码必须6到16位，且不能出现空格'
					],
					password: [
						/^[\S]{6,16}$/
						,'新密码必须6到16位，且不能出现空格'
					],
					repassword: [
						/^[\S]{6,16}$/
						,'重复密码必须6到16位，且不能出现空格'
					],
				});
		
				// 通用表单提交
				form.on('submit(demo)', function(data){
					var type = $(data.form).attr('method') == 'post' ? 'post' : 'get' ;
					var url = $(data.form).attr('action') == '' ? '#' : $(data.form).attr('action');
					var jump = $(data.form).attr('jump');
					var async = $(data.form).attr('async') != 'true' ? false : true ;
					if($(data.form).attr('console')){  //打印表单提交数据
						console.log('表单数据',data.field);
					}
					
					$.ajax({
						url:url,
						type:type,
						async:async,    //或true,是否同步
						data:data.field,
						timeout:5000,    //超时时间
						dataType:'json',    //返回的数据格式：json/xml/html/script/jsonp/text
						success:function(res) {
							if($(data.form).attr('console')){  //打印接口返回结果
								console.log(res);
							}
							layer.msg(res.message ,{icon:(res.code == 200)? 1 : 2,time:2000}, function(){
							    if( res.url && res.url != '' ){
							        window.location.href = res.url;
							    }
							});
						}
						
					})
					return false; //阻止自带表单提交
				});
			
		}();
		</script>
</body>
</html>